import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/admin/system/index/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/admin/system/index/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/admin/system/index/logout',
    method: 'get'
  })
}

const baseUrl=`/admin/system/sysUser`;

export default {
  getPageList(page,limit,searchObj){
    return request({
      url:`${baseUrl}/${page}/${limit}`,
      method:"GET",
      params:searchObj
    })
  },
  findById(id){
    return request({
      url:`${baseUrl}/user/${id}`,
      method:"GET",
    })
  },
  save(data){
    return request({
      url:`${baseUrl}/save`,
      method:"POST",
      data,
    })
  },
  update(data){
    return request({
      url:`${baseUrl}/update`,
      method:"POST",
      data,
    })
  },
  updateStatus(id,status){
    return request({
      url:`${baseUrl}/update/${id}/${status}`,
      method:"get",
    })
  },
  remove(id){
    return request({
      url:`${baseUrl}/remove/${id}`,
      method:"delete"
    })
  },
  toAssign(id){
    return request({
      url:`${baseUrl}/toAssign/${id}`,
      method:"get"
    })
  },
  doAssign(data){
    return request({
      url:`${baseUrl}/doAssign`,
      method:"POST",
      data
    })
  },
}
